import initData from "./initData";

export default function reducer(state = initData, action) {
  switch (action.type) {
    case 'INCREMENT':
      return { ...state, count: state.count + action.num };
    case 'DECREMENT':
      return { ...state, count: state.count - action.num };
    case 'LOGINSTATE':
      return { ...state, loginState: action.boolValue };
    case 'MODIFY_USER_INFO':
      return { ...state, userInfo: action.info, loginState: action.boolValue }
    default:
      return { ...state }
  }
}